//
//  EmoticonCell.m
//  WLEmotionKeyBoard
//
//  Created by wanglei on 16/12/8.
//  Copyright © 2016年 wanglei. All rights reserved.
//

#import "EmoticonCell.h"

@implementation EmoticonCell

-(instancetype)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    UIButton *emoticonBtn = [[UIButton alloc]init];
    self.emoticonBtn = emoticonBtn;
    [self setupUI];
    return self;
}

- (void)setupUI{
    [self.contentView addSubview:_emoticonBtn];
    [_emoticonBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self);
    }];
    _emoticonBtn.titleLabel.font = [UIFont systemFontOfSize:32];
    _emoticonBtn.userInteractionEnabled = false;
    
}
- (void)setEmoticon:(Emoticon *)emoticon{
    _emoticon = emoticon;
    NSLog(@"emoticon = %@",emoticon.imagePath);
    NSLog(@"emoticon.emojiStr = %@",_emoticon.imagePath);
    [_emoticonBtn setImage:[UIImage imageWithContentsOfFile:emoticon.imagePath] forState:UIControlStateNormal];
    [_emoticonBtn setTitle:emoticon.emojiStr forState:UIControlStateNormal];
//    如果是删除的模型
    if(_emoticon != nil && _emoticon.isDelete ){
        [_emoticonBtn setImage:[UIImage imageNamed:@"compose_emotion_delete"] forState:UIControlStateNormal];
    }
}
@end
